package github.fafaovo.common.guiblock;

import net.minecraft.util.IIntArray;

import java.util.HashMap;

public class MyIntArray implements IIntArray {
    int count = 0;
    int ratEnergy = 0;
    int ratGate = 0;
    int energy = 0;
    int gate = 0;
    HashMap<Integer,Integer> Mmap = new HashMap<>(3);

    @Override
    public int get(int index) {
        if(index == 0) return count;
        else if(index == 1) return ratEnergy;
        else if(index == 2) return ratGate;
        else if(index == 3) return energy;
        else if(index == 4) return gate;
        return 0;
        //return Mmap.get(index);
    }

    @Override
    public void set(int index, int value) {
        if(index == 0) count = value;
        else if(index == 1) ratEnergy = value;
        else if(index == 2) ratGate = value;
        else if(index == 3) energy = value;
        else if(index == 4) gate = value;
        //Mmap.putIfAbsent(index,value);
    }

    @Override
    public int size() {
        return 5;
    }

    public int ratio(double mapDist,double actDist,double atp)
    {
        if(actDist == 0)
            return 0;
        return (int) (mapDist / actDist * atp);
    }
}
